<?php

namespace app\index\controller;

use app\BaseController;
use frame\lib\Db;

class Base extends BaseController
{
    protected $uid;
    public function __construct()
    {
        parent::__construct();
        if (!@$_SESSION['user']['username']) {
            exit("<script>alert('请登录后再来操作');location.href='?p=index&c=login&a=index';</script>");
        }
        $this->uid = $_SESSION['user']['id'];
        // $arrowCont = ['Index', 'Config','User'];
        /* 允许的行为 ， */
        $arrowAct = ['index', 'list', 'get', 'add', 'edit'];
        // 特殊Uri允许
        $peiUri = ['Feedback/add', 'Fake/use'];
        $uri = CONTROLLER . '/' . ACTION;
        if (!in_array($uri, $peiUri)) {
            if (!in_array(ACTION, $arrowAct)) {
                $this->verifyVip($this->uid);
            }
        }
    }
}
